.class public Lcom/opongo/blogapp/activities/PostViewActivity;
.super Landroid/app/Activity;
.source "PostViewActivity.java"


# static fields
#the value of this static final field might be set in the static constructor
.field public static final DEBUG:Z = false

.field public static final PREFS_NAME:Ljava/lang/String; = "BlogApp"

.field private static final TAG:Ljava/lang/String;


# instance fields
.field private context:Landroid/content/Context;

.field private dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

.field private detail_html:Ljava/lang/String;

.field private post:Lcom/opongo/blogapp/common/Post;

.field private postContentView:Landroid/webkit/WebView;

.field private settings:Landroid/content/SharedPreferences;

.field private tableName:Ljava/lang/String;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 42
    sget-boolean v0, Lcom/opongo/blogapp/AbaSettings;->DEBUG:Z

    sput-boolean v0, Lcom/opongo/blogapp/activities/PostViewActivity;->DEBUG:Z

    .line 43
    const-class v0, Lcom/opongo/blogapp/activities/PostViewActivity;

    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/opongo/blogapp/activities/PostViewActivity;->TAG:Ljava/lang/String;

    .line 39
    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .prologue
    .line 39
    invoke-direct {p0}, Landroid/app/Activity;-><init>()V

    return-void
.end method

.method static synthetic access$0(Lcom/opongo/blogapp/activities/PostViewActivity;)Lcom/opongo/blogapp/manager/DatabaseManager;
    .locals 1
    .parameter

    .prologue
    .line 52
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    return-object v0
.end method

.method static synthetic access$1(Lcom/opongo/blogapp/activities/PostViewActivity;)Lcom/opongo/blogapp/common/Post;
    .locals 1
    .parameter

    .prologue
    .line 51
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->post:Lcom/opongo/blogapp/common/Post;

    return-object v0
.end method

.method private showGenericAlert()V
    .locals 3

    .prologue
    .line 201
    new-instance v1, Landroid/app/AlertDialog$Builder;

    invoke-direct {v1, p0}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V

    invoke-virtual {v1}, Landroid/app/AlertDialog$Builder;->create()Landroid/app/AlertDialog;

    move-result-object v0

    .line 202
    .local v0, alertDialog:Landroid/app/AlertDialog;
    const v1, 0x7f070024

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/activities/PostViewActivity;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/app/AlertDialog;->setTitle(Ljava/lang/CharSequence;)V

    .line 203
    const v1, 0x7f070025

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/activities/PostViewActivity;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/app/AlertDialog;->setMessage(Ljava/lang/CharSequence;)V

    .line 204
    const v1, 0x7f020009

    invoke-virtual {v0, v1}, Landroid/app/AlertDialog;->setIcon(I)V

    .line 206
    const-string v1, "OK"

    new-instance v2, Lcom/opongo/blogapp/activities/PostViewActivity$2;

    invoke-direct {v2, p0}, Lcom/opongo/blogapp/activities/PostViewActivity$2;-><init>(Lcom/opongo/blogapp/activities/PostViewActivity;)V

    invoke-virtual {v0, v1, v2}, Landroid/app/AlertDialog;->setButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)V

    .line 212
    invoke-virtual {v0}, Landroid/app/AlertDialog;->show()V

    .line 213
    return-void
.end method


# virtual methods
.method public addBookmark()V
    .locals 5

    .prologue
    const/4 v4, 0x0

    .line 229
    new-instance v0, Lcom/opongo/blogapp/manager/DatabaseManager;

    .line 230
    const-string v2, "bookmarks"

    const-string v3, "INSERT INTO bookmarks (id,title,date,content,categories,commentscount,imageurl,post_order,guid,opened,newpost,did_vote,post_author,post_price,post_rating) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);"

    .line 229
    invoke-direct {v0, p0, v2, v3}, Lcom/opongo/blogapp/manager/DatabaseManager;-><init>(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V

    .line 232
    .local v0, _dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;
    iget-object v2, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->post:Lcom/opongo/blogapp/common/Post;

    iget v2, v2, Lcom/opongo/blogapp/common/Post;->id:I

    int-to-long v2, v2

    invoke-virtual {v0, v2, v3}, Lcom/opongo/blogapp/manager/DatabaseManager;->bookmarkExists(J)Z

    move-result v2

    if-nez v2, :cond_0

    .line 233
    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "INSERT OR IGNORE INTO bookmarks SELECT * FROM "

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    .line 234
    iget-object v3, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->tableName:Ljava/lang/String;

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    .line 235
    const-string v3, " WHERE id="

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    iget-object v3, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->post:Lcom/opongo/blogapp/common/Post;

    iget v3, v3, Lcom/opongo/blogapp/common/Post;->id:I

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 233
    invoke-virtual {v0, v2}, Lcom/opongo/blogapp/manager/DatabaseManager;->execQuery(Ljava/lang/String;)V

    .line 236
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/PostViewActivity;->getApplicationContext()Landroid/content/Context;

    move-result-object v2

    .line 237
    const v3, 0x7f07003e

    invoke-virtual {p0, v3}, Lcom/opongo/blogapp/activities/PostViewActivity;->getString(I)Ljava/lang/String;

    move-result-object v3

    .line 236
    invoke-static {v2, v3, v4}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;

    move-result-object v1

    .line 238
    .local v1, toast:Landroid/widget/Toast;
    invoke-virtual {v1}, Landroid/widget/Toast;->show()V

    .line 245
    :goto_0
    invoke-virtual {v0}, Lcom/opongo/blogapp/manager/DatabaseManager;->close()V

    .line 246
    return-void

    .line 240
    .end local v1           #toast:Landroid/widget/Toast;
    :cond_0
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/PostViewActivity;->getApplicationContext()Landroid/content/Context;

    move-result-object v2

    .line 241
    const v3, 0x7f07003f

    invoke-virtual {p0, v3}, Lcom/opongo/blogapp/activities/PostViewActivity;->getString(I)Ljava/lang/String;

    move-result-object v3

    .line 240
    invoke-static {v2, v3, v4}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;

    move-result-object v1

    .line 243
    .restart local v1       #toast:Landroid/widget/Toast;
    invoke-virtual {v1}, Landroid/widget/Toast;->show()V

    goto :goto_0
.end method

.method public onCreate(Landroid/os/Bundle;)V
    .locals 5
    .parameter "savedInstanceState"

    .prologue
    const/4 v4, 0x1

    .line 56
    invoke-super {p0, p1}, Landroid/app/Activity;->onCreate(Landroid/os/Bundle;)V

    .line 58
    const v2, 0x7f030011

    invoke-virtual {p0, v2}, Lcom/opongo/blogapp/activities/PostViewActivity;->setContentView(I)V

    .line 60
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/PostViewActivity;->getIntent()Landroid/content/Intent;

    move-result-object v2

    invoke-virtual {v2}, Landroid/content/Intent;->getExtras()Landroid/os/Bundle;

    move-result-object v0

    .line 63
    .local v0, extras:Landroid/os/Bundle;
    if-nez v0, :cond_1

    .line 64
    invoke-direct {p0}, Lcom/opongo/blogapp/activities/PostViewActivity;->showGenericAlert()V

    .line 140
    :cond_0
    :goto_0
    return-void

    .line 68
    :cond_1
    const-string v2, "POST"

    invoke-virtual {v0, v2}, Landroid/os/Bundle;->getSerializable(Ljava/lang/String;)Ljava/io/Serializable;

    move-result-object v2

    check-cast v2, Lcom/opongo/blogapp/common/Post;

    iput-object v2, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->post:Lcom/opongo/blogapp/common/Post;

    .line 69
    const-string v2, "TABLENAME"

    invoke-virtual {v0, v2}, Landroid/os/Bundle;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    iput-object v2, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->tableName:Ljava/lang/String;

    .line 70
    new-instance v2, Lcom/opongo/blogapp/manager/DatabaseManager;

    iget-object v3, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->tableName:Ljava/lang/String;

    invoke-direct {v2, p0, v3}, Lcom/opongo/blogapp/manager/DatabaseManager;-><init>(Landroid/content/Context;Ljava/lang/String;)V

    iput-object v2, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    .line 73
    new-instance v1, Lcom/opongo/blogapp/activities/PostViewActivity$1;

    invoke-direct {v1, p0}, Lcom/opongo/blogapp/activities/PostViewActivity$1;-><init>(Lcom/opongo/blogapp/activities/PostViewActivity;)V

    .line 126
    .local v1, mWebClient:Landroid/webkit/WebViewClient;
    const v2, 0x7f08002d

    invoke-virtual {p0, v2}, Lcom/opongo/blogapp/activities/PostViewActivity;->findViewById(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Landroid/webkit/WebView;

    iput-object v2, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->postContentView:Landroid/webkit/WebView;

    .line 127
    iget-object v2, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->postContentView:Landroid/webkit/WebView;

    invoke-virtual {v2}, Landroid/webkit/WebView;->getSettings()Landroid/webkit/WebSettings;

    move-result-object v2

    invoke-virtual {v2, v4}, Landroid/webkit/WebSettings;->setJavaScriptEnabled(Z)V

    .line 130
    iget-object v2, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->postContentView:Landroid/webkit/WebView;

    invoke-virtual {v2, v1}, Landroid/webkit/WebView;->setWebViewClient(Landroid/webkit/WebViewClient;)V

    .line 132
    iget-object v2, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->postContentView:Landroid/webkit/WebView;

    invoke-virtual {v2}, Landroid/webkit/WebView;->getSettings()Landroid/webkit/WebSettings;

    move-result-object v2

    invoke-virtual {v2, v4}, Landroid/webkit/WebSettings;->setBuiltInZoomControls(Z)V

    .line 134
    iget-object v2, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->postContentView:Landroid/webkit/WebView;

    const/4 v3, 0x0

    invoke-virtual {v2, v3}, Landroid/webkit/WebView;->setScrollBarStyle(I)V

    .line 138
    iget-object v2, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->post:Lcom/opongo/blogapp/common/Post;

    iget v2, v2, Lcom/opongo/blogapp/common/Post;->id:I

    if-eqz v2, :cond_0

    .line 139
    iget-object v2, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->post:Lcom/opongo/blogapp/common/Post;

    invoke-virtual {p0, v2}, Lcom/opongo/blogapp/activities/PostViewActivity;->showPost(Lcom/opongo/blogapp/common/Post;)V

    goto :goto_0
.end method

.method public onCreateOptionsMenu(Landroid/view/Menu;)Z
    .locals 1
    .parameter "menu"

    .prologue
    .line 197
    invoke-super {p0, p1}, Landroid/app/Activity;->onCreateOptionsMenu(Landroid/view/Menu;)Z

    move-result v0

    return v0
.end method

.method public onDestroy()V
    .locals 2

    .prologue
    .line 190
    sget-boolean v0, Lcom/opongo/blogapp/activities/PostViewActivity;->DEBUG:Z

    if-eqz v0, :cond_0

    sget-object v0, Lcom/opongo/blogapp/activities/PostViewActivity;->TAG:Ljava/lang/String;

    const-string v1, "onDestroy"

    invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 191
    :cond_0
    invoke-super {p0}, Landroid/app/Activity;->onDestroy()V

    .line 192
    return-void
.end method

.method public onNewIntent(Landroid/content/Intent;)V
    .locals 0
    .parameter "intent"

    .prologue
    .line 280
    invoke-super {p0, p1}, Landroid/app/Activity;->onNewIntent(Landroid/content/Intent;)V

    .line 281
    return-void
.end method

.method public onOptionsItemSelected(Landroid/view/MenuItem;)Z
    .locals 3
    .parameter "item"

    .prologue
    const/4 v0, 0x1

    .line 284
    invoke-interface {p1}, Landroid/view/MenuItem;->getItemId()I

    move-result v1

    const v2, 0x7f080067

    if-ne v1, v2, :cond_0

    .line 285
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/PostViewActivity;->showComments()V

    .line 294
    :goto_0
    return v0

    .line 287
    :cond_0
    invoke-interface {p1}, Landroid/view/MenuItem;->getItemId()I

    move-result v1

    const v2, 0x7f080065

    if-ne v1, v2, :cond_1

    .line 288
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/PostViewActivity;->addBookmark()V

    goto :goto_0

    .line 290
    :cond_1
    invoke-interface {p1}, Landroid/view/MenuItem;->getItemId()I

    move-result v1

    const v2, 0x7f080066

    if-ne v1, v2, :cond_2

    .line 291
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/PostViewActivity;->share()V

    goto :goto_0

    .line 294
    :cond_2
    invoke-super {p0, p1}, Landroid/app/Activity;->onOptionsItemSelected(Landroid/view/MenuItem;)Z

    move-result v0

    goto :goto_0
.end method

.method public onResume()V
    .locals 6

    .prologue
    .line 144
    sget-boolean v0, Lcom/opongo/blogapp/activities/PostViewActivity;->DEBUG:Z

    if-eqz v0, :cond_0

    .line 145
    sget-object v0, Lcom/opongo/blogapp/activities/PostViewActivity;->TAG:Ljava/lang/String;

    const-string v1, "onResume"

    invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 146
    :cond_0
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->postContentView:Landroid/webkit/WebView;

    if-eqz v0, :cond_1

    .line 147
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->postContentView:Landroid/webkit/WebView;

    const-string v1, "fake://foo.bar"

    iget-object v2, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->detail_html:Ljava/lang/String;

    .line 148
    const-string v3, "text/html"

    const-string v4, "UTF-8"

    const/4 v5, 0x0

    .line 147
    invoke-virtual/range {v0 .. v5}, Landroid/webkit/WebView;->loadDataWithBaseURL(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    .line 151
    :cond_1
    invoke-super {p0}, Landroid/app/Activity;->onResume()V

    .line 152
    return-void
.end method

.method public share()V
    .locals 13

    .prologue
    .line 249
    iget-object v10, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->post:Lcom/opongo/blogapp/common/Post;

    iget-object v6, v10, Lcom/opongo/blogapp/common/Post;->guid:Ljava/lang/String;

    .line 250
    .local v6, guid:Ljava/lang/String;
    iget-object v10, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->post:Lcom/opongo/blogapp/common/Post;

    iget-object v9, v10, Lcom/opongo/blogapp/common/Post;->title:Ljava/lang/String;

    .line 252
    .local v9, title:Ljava/lang/String;
    iget-object v10, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->settings:Landroid/content/SharedPreferences;

    const-string v11, "blog_details"

    const-string v12, ""

    invoke-interface {v10, v11, v12}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 254
    .local v0, detailString:Ljava/lang/String;
    const-string v2, ""

    .line 255
    .local v2, emailLayout:Ljava/lang/String;
    const-string v4, ""

    .line 257
    .local v4, emailSubject:Ljava/lang/String;
    :try_start_0
    new-instance v8, Lorg/json/JSONObject;

    invoke-direct {v8, v0}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    .line 259
    .local v8, json:Lorg/json/JSONObject;
    new-instance v3, Ljava/lang/String;

    const-string v10, "detail_email_body"

    invoke-virtual {v8, v10}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v10

    invoke-direct {v3, v10}, Ljava/lang/String;-><init>(Ljava/lang/String;)V
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    .line 260
    .end local v2           #emailLayout:Ljava/lang/String;
    .local v3, emailLayout:Ljava/lang/String;
    :try_start_1
    new-instance v5, Ljava/lang/String;

    const-string v10, "detail_email_subject"

    invoke-virtual {v8, v10}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v10

    invoke-direct {v5, v10}, Ljava/lang/String;-><init>(Ljava/lang/String;)V
    :try_end_1
    .catch Lorg/json/JSONException; {:try_start_1 .. :try_end_1} :catch_1

    .line 262
    .end local v4           #emailSubject:Ljava/lang/String;
    .local v5, emailSubject:Ljava/lang/String;
    :try_start_2
    const-string v10, "#post_title#"

    invoke-virtual {v3, v10, v9}, Ljava/lang/String;->replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    :try_end_2
    .catch Lorg/json/JSONException; {:try_start_2 .. :try_end_2} :catch_2

    move-result-object v2

    .line 263
    .end local v3           #emailLayout:Ljava/lang/String;
    .restart local v2       #emailLayout:Ljava/lang/String;
    :try_start_3
    const-string v10, "#post_link#"

    invoke-virtual {v2, v10, v6}, Ljava/lang/String;->replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    :try_end_3
    .catch Lorg/json/JSONException; {:try_start_3 .. :try_end_3} :catch_3

    move-result-object v2

    move-object v4, v5

    .line 270
    .end local v5           #emailSubject:Ljava/lang/String;
    .end local v8           #json:Lorg/json/JSONObject;
    .restart local v4       #emailSubject:Ljava/lang/String;
    :goto_0
    new-instance v7, Landroid/content/Intent;

    const-string v10, "android.intent.action.SEND"

    invoke-direct {v7, v10}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 271
    .local v7, intent:Landroid/content/Intent;
    const-string v10, "text/plain"

    invoke-virtual {v7, v10}, Landroid/content/Intent;->setType(Ljava/lang/String;)Landroid/content/Intent;

    .line 272
    const-string v10, "android.intent.extra.TEXT"

    invoke-virtual {v7, v10, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 273
    const-string v10, "android.intent.extra.SUBJECT"

    invoke-virtual {v7, v10, v4}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 275
    const v10, 0x7f070038

    invoke-virtual {p0, v10}, Lcom/opongo/blogapp/activities/PostViewActivity;->getString(I)Ljava/lang/String;

    move-result-object v10

    invoke-static {v7, v10}, Landroid/content/Intent;->createChooser(Landroid/content/Intent;Ljava/lang/CharSequence;)Landroid/content/Intent;

    move-result-object v10

    invoke-virtual {p0, v10}, Lcom/opongo/blogapp/activities/PostViewActivity;->startActivity(Landroid/content/Intent;)V

    .line 276
    return-void

    .line 265
    .end local v7           #intent:Landroid/content/Intent;
    :catch_0
    move-exception v1

    .line 267
    .local v1, e:Lorg/json/JSONException;
    :goto_1
    invoke-virtual {v1}, Lorg/json/JSONException;->printStackTrace()V

    goto :goto_0

    .line 265
    .end local v1           #e:Lorg/json/JSONException;
    .end local v2           #emailLayout:Ljava/lang/String;
    .restart local v3       #emailLayout:Ljava/lang/String;
    .restart local v8       #json:Lorg/json/JSONObject;
    :catch_1
    move-exception v1

    move-object v2, v3

    .end local v3           #emailLayout:Ljava/lang/String;
    .restart local v2       #emailLayout:Ljava/lang/String;
    goto :goto_1

    .end local v2           #emailLayout:Ljava/lang/String;
    .end local v4           #emailSubject:Ljava/lang/String;
    .restart local v3       #emailLayout:Ljava/lang/String;
    .restart local v5       #emailSubject:Ljava/lang/String;
    :catch_2
    move-exception v1

    move-object v4, v5

    .end local v5           #emailSubject:Ljava/lang/String;
    .restart local v4       #emailSubject:Ljava/lang/String;
    move-object v2, v3

    .end local v3           #emailLayout:Ljava/lang/String;
    .restart local v2       #emailLayout:Ljava/lang/String;
    goto :goto_1

    .end local v4           #emailSubject:Ljava/lang/String;
    .restart local v5       #emailSubject:Ljava/lang/String;
    :catch_3
    move-exception v1

    move-object v4, v5

    .end local v5           #emailSubject:Ljava/lang/String;
    .restart local v4       #emailSubject:Ljava/lang/String;
    goto :goto_1
.end method

.method public showComments()V
    .locals 3

    .prologue
    .line 216
    new-instance v0, Landroid/content/Intent;

    const-class v1, Lcom/opongo/blogapp/activities/CommentsListActivity;

    invoke-direct {v0, p0, v1}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 217
    .local v0, intent:Landroid/content/Intent;
    const-string v1, "POSTID"

    iget-object v2, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->post:Lcom/opongo/blogapp/common/Post;

    iget v2, v2, Lcom/opongo/blogapp/common/Post;->id:I

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;

    .line 218
    const-string v1, "TABLENAME"

    iget-object v2, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->tableName:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 219
    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/activities/PostViewActivity;->startActivity(Landroid/content/Intent;)V

    .line 220
    return-void
.end method

.method public showPost(Lcom/opongo/blogapp/common/Post;)V
    .locals 11
    .parameter "p"

    .prologue
    .line 155
    iput-object p1, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->post:Lcom/opongo/blogapp/common/Post;

    .line 157
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->post:Lcom/opongo/blogapp/common/Post;

    iget-object v6, v0, Lcom/opongo/blogapp/common/Post;->content:Ljava/lang/String;

    .line 160
    .local v6, content:Ljava/lang/String;
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/PostViewActivity;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    iput-object v0, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->context:Landroid/content/Context;

    .line 161
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->context:Landroid/content/Context;

    const-string v1, "BlogApp"

    const/4 v2, 0x0

    invoke-virtual {v0, v1, v2}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v0

    iput-object v0, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->settings:Landroid/content/SharedPreferences;

    .line 163
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->settings:Landroid/content/SharedPreferences;

    const-string v1, "blog_details"

    const-string v2, "null"

    invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v7

    .line 166
    .local v7, detailString:Ljava/lang/String;
    :try_start_0
    new-instance v10, Lorg/json/JSONObject;

    invoke-direct {v10, v7}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    .line 168
    .local v10, json:Lorg/json/JSONObject;
    new-instance v0, Ljava/lang/String;

    const-string v1, "detail_html"

    invoke-virtual {v10, v1}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/String;-><init>(Ljava/lang/String;)V

    iput-object v0, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->detail_html:Ljava/lang/String;

    .line 170
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->detail_html:Ljava/lang/String;

    const-string v1, ""

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 171
    const-string v0, "Es ist beim Laden ein Fehler aufgetreten. Bitte versuchen Sie es zum sp\u00d4\u00f8\u03a9teren Zeitpunkt noch einmal."

    iput-object v0, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->detail_html:Ljava/lang/String;

    .line 174
    :cond_0
    const-string v0, "detail_css"

    invoke-virtual {v10, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v8

    .line 176
    .local v8, detail_css:Ljava/lang/String;
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->detail_html:Ljava/lang/String;

    const-string v1, "#post_css#"

    invoke-virtual {v0, v1, v8}, Ljava/lang/String;->replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->detail_html:Ljava/lang/String;

    .line 177
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->detail_html:Ljava/lang/String;

    const-string v1, "#post_content#"

    invoke-virtual {v0, v1, v6}, Ljava/lang/String;->replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->detail_html:Ljava/lang/String;

    .line 179
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->postContentView:Landroid/webkit/WebView;

    const-string v1, "fake://foo.bar"

    iget-object v2, p0, Lcom/opongo/blogapp/activities/PostViewActivity;->detail_html:Ljava/lang/String;

    .line 180
    const-string v3, "text/html"

    const-string v4, "UTF-8"

    const/4 v5, 0x0

    .line 179
    invoke-virtual/range {v0 .. v5}, Landroid/webkit/WebView;->loadDataWithBaseURL(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    .line 186
    .end local v8           #detail_css:Ljava/lang/String;
    .end local v10           #json:Lorg/json/JSONObject;
    :goto_0
    return-void

    .line 182
    :catch_0
    move-exception v9

    .line 184
    .local v9, e:Lorg/json/JSONException;
    invoke-virtual {v9}, Lorg/json/JSONException;->printStackTrace()V

    goto :goto_0
.end method
